package com.xsky.table.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.dom4j.Element;

public class Table {
	private Map<String,Column> columns = new HashMap<String,Column>();
	
	private Map<String,Column> labels = new HashMap<String,Column>(); 
	
	private ArrayList<Column> columnList = new ArrayList<Column>(50);
	
	private Element xml = null;
	
	public Element getXml() {
		return xml;
	}

	public void setXml(Element xml) {
		this.xml = xml;
	}

	public ArrayList<Column> getColumnList() {
		return columnList;
	}

	public void setColumnList(ArrayList<Column> columnList) {
		this.columnList = columnList;
	}

	private String[] primaryKeys = new String[0];

	public Map<String, Column> getColumns() {
		return columns;
	}

	public void setColumns(Map<String, Column> columns) {
		this.columns = columns;
	}

	public Map<String, Column> getLabels() {
		return labels;
	}

	public void setLabels(Map<String, Column> labels) {
		this.labels = labels;
	}

	public String[] getPrimaryKeys() {
		return primaryKeys;
	}

	public void setPrimaryKeys(String[] primaryKeys) {
		this.primaryKeys = primaryKeys;
	}
	
	public Column getColumnByLabel(String label){
		return this.labels.get(label);
	} 
	
	public Column getColumnByName(String name){
		return this.columns.get(name);
	}
}
